package com.wangjiacai.hqlQuery.role.repository;

import com.wangjiacai.hqlQuery.role.entity.Function;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/*
 * @auther: wangjiacai
 *
 * @create: 2018-04-23 11:54:50
 */
public interface FunctionRepository extends JpaRepository<Function,String> {

    List<Function> findByIdInOrderByBh(List<String> ids);

    @Query("select bh from Function where url is not null and url <> '' and id in (?1)")
    List<String> findBhByIdInAndUrlIsNotNull(List<String> ids);

    @Query("select id from Function where bh = ?1")
    String findFunctionIdByBh(String bh);

}
